﻿using IoTSocket.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WCS.Entities.Api
{
    public class ApiResultHelp
    {
        //成功后返回的数据
        public static ApiResult Success(dynamic data)
        {
            return new ApiResult
            {
                returnCode = 200,
                data = data,
                returnMsg = "操作成功",
                returnUserMsg = 1
            };
        }
        public static ApiResult Success()
        {
            return new ApiResult
            {
                returnCode = 200,
                data = null,
                returnMsg = "操作成功",
                returnUserMsg = 1
            };
        }
        public static ApiResult Error(int code, string msg)
        {
            return new ApiResult
            {
                returnCode = 500,
                data = "fail",
                returnMsg = msg,
            };
        }
        public static ApiResult Error(string msg)
        {
            return new ApiResult
            {
                returnCode = 500,
                data = "fail",
                returnMsg = msg,
            };
        }
    }
}
